//
//  binTableViewCell.swift
//  Wmsmobile
//
//  Created by wangshuning on 16/9/9.
//  Copyright © 2016年 www.hd123.com. All rights reserved.
//

import UIKit

class binTableViewCell: UITableViewCell {
    //MARK: - property
    var info:[String : String]?{
        didSet{
            self.labelLeft.text = (info?["title"] ?? "")
            self.labelRight.text = (info?["detail"] ?? "")
            self.icon.image = UIImage(named:"椭圆-灰")
            self.labelRight.font = UIFont.systemFont(ofSize: (WMSFonts["founctionCell"]!)[userInfo!.fontLevel.rawValue])
            self.labelRight.textColor = UIColor.hexStringToUIColor("#666666")
        }
    }
    lazy fileprivate var icon:UIImageView = {
        let imageView = UIImageView()
        return imageView
    }()
    lazy var labelLeft:UILabel = {
        let label = UILabel()
        //        label.backgroundColor = UIColor.greenColor()
        label.font = UIFont.systemFont(ofSize: (WMSFonts["founctionCell"]!)[userInfo!.fontLevel.rawValue])
        return label
    }()
    lazy fileprivate var labelRight:UILabel = {
        let label = UILabel()
//                label.backgroundColor = UIColor.redColor()
        label.textAlignment = .left
        label.numberOfLines = 0
        return label
    }()
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: UITableViewCellStyle.default, reuseIdentifier: reuseIdentifier)
        self.setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI(){
        self.contentView.addSubview(icon)
        self.contentView.addSubview(labelLeft)
        self.contentView.addSubview(labelRight)
        self.icon.isHidden = false
        self.icon.snp.makeConstraints { (make) in
            make.centerY.equalTo(self)
            make.leading.equalTo(self).offset(15)
        }
        labelLeft.snp.makeConstraints { (make) in
            make.centerY.equalTo(self)
            make.leading.equalTo(self).offset(30)
            make.trailing.equalTo(-(KscreenWidth-140))
            make.height.equalTo(25)
        }
        labelRight.snp.makeConstraints { (make) in
            make.centerY.equalTo(self)
            make.trailing.equalTo(self).offset(-15)
            make.leading.equalTo(self).offset(145)
            make.height.equalTo(44)
        }
    }

}
